const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: "./",
  // chainWebpack: (config) => {
  //   config.module
  //     .rule("swf")
  //     .test(/\.swf$/)
  //     .use("url-loader")
  //     .loader("url-loader")
  //     .options({ limit: 10000 });
  // },
  devServer: {
    host: "localhost", //本地
    port: 8865, //端口号
    open: true, //默认false   true自动打开
    proxy: { 
      '/AwMusic': {
        target: "https://autumnfish.cn", // 这个链接是要代理到的地址
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          '^/AwMusic': '' // 重写路径
        }
      }
    }
  },

  configureWebpack: {
    //   配置路径别名
    resolve: {
      extensions: [".js", ".vue", ".json"],
      alias: {
        "@": resolve("src"),
        "~": process.cwd(),
        public: resolve("public"),
        components: resolve("src/components"),
        util: resolve("src/utils"),
        store: resolve("src/store"),
        router: resolve("src/router"),
      },
    },
  },
  transpileDependencies: ["element-ui"],
};
